package com.hdy.web.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class StringToNumberUtil {
    public static boolean isNum(String str){
        Pattern p = Pattern.compile(".*\\d+.*");
        Matcher m = p.matcher(str);
        return m.matches();
    }
    public static String convert(String remark) {
        StringBuilder result = new StringBuilder();
        Pattern p = Pattern.compile(".*\\d+.*");
        Matcher m = p.matcher(remark);
        if (m.matches()) {
            Pattern pattern = Pattern.compile("\\d+(\\.\\d+)?");
            Matcher matcher = pattern.matcher(remark);
            result = new StringBuilder();
            while (matcher.find()) {
                result.append(matcher.group(0));
            }
        }
        return result.toString();
    }
}
